<?php

/**
 * Visa form base class.
 *
 * @package    form
 * @subpackage visa
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BaseVisaForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'           => new sfWidgetFormInputHidden(),
      'visatype_id'  => new sfWidgetFormDoctrineChoice(array('model' => 'VisaType', 'add_empty' => false)),
      'date_issued'  => new sfWidgetFormDate(),
      'date_valid'   => new sfWidgetFormDate(),
      'date_renewal' => new sfWidgetFormDate(),
      'renewal'      => new sfWidgetFormInputCheckbox(),
      'person_id'    => new sfWidgetFormDoctrineChoice(array('model' => 'Person', 'add_empty' => false)),
      'created_at'   => new sfWidgetFormDateTime(),
      'updated_at'   => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'           => new sfValidatorDoctrineChoice(array('model' => 'Visa', 'column' => 'id', 'required' => false)),
      'visatype_id'  => new sfValidatorDoctrineChoice(array('model' => 'VisaType')),
      'date_issued'  => new sfValidatorDate(),
      'date_valid'   => new sfValidatorDate(),
      'date_renewal' => new sfValidatorDate(),
      'renewal'      => new sfValidatorBoolean(array('required' => false)),
      'person_id'    => new sfValidatorDoctrineChoice(array('model' => 'Person')),
      'created_at'   => new sfValidatorDateTime(array('required' => false)),
      'updated_at'   => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('visa[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Visa';
  }

}
